package day1109.observer;

import java.math.BigDecimal;

/**
 * @author Mr.ma
 * @since 2022/11/9 15:46
 * 拍卖师，subject，观察主题，包含对观察者的增删以及通知方法
 **/
public class Auctioneer extends AuctioneerAbstract{
    private String name;

    public Auctioneer() {
    }

    public Auctioneer(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    /**
     * 竞拍人出席拍卖,退场
     * @param bidders
     */
    @Override
    public void attend(Bidders bidders){
        biddersList.add(bidders);
    }

    /**
     * 竞拍人退出拍卖会
     * @param bidders
     */
    @Override
    public void exit(Bidders bidders){
        biddersList.remove(bidders);
    }

    /**
     * 更新商品报价
     * @param auctionPrice
     */
    @Override
    public void updateAll(BigDecimal auctionPrice){
        for (Bidders bidder : biddersList) {
            bidder.getPrice();
        }
    }
}
